layui.use(['form', 'layer', 'formSelects'], function () {
    var form = layui.form,
        layer = layui.layer,
        $ = layui.jquery;
    var formSelects = layui.formSelects;

    /**
     * 在 iframe 页面关闭自身时  关闭自身弹出层
     */
    $("#closeBtn").click(function () {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    })
    /**
     * 表单添加 取消
     */
    form.on('submit(updateUser)', function (data) {
        //  数据加载层

        var formData = data.field;
        var url = ctx + "/emp/update";

        $.post(url, formData, function (result) {
            console.log(formData)
            // 判断 操作是否返回成功
            if (result.code == 200) {
                layer.msg("用户修改成功 ， 将在3秒后退出", {time: 3000, icon: 6}, function () {
                    $.removeCookie("rememberMe", {domain: "localhost", path: "/erp"})
                    window.parent.location.href = ctx + "/index"
                })
            } else {
                layer.msg(result.msg)
            }
        });

    });


});